﻿<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../helpproject.xsl" ?>
<topic template="Default" lasteditedby="Geert" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../helpproject.xsd">
  <title translate="true">Pixel shaders</title>
  <keywords>
    <keyword translate="true">Pixel shaders</keyword>
    <keyword translate="true">Styles</keyword>
    <keyword translate="true">Themes</keyword>
  </keywords>
  <body>
    <header>
      <para styleclass="Heading1"><text styleclass="Heading1" translate="true">Pixel shaders</text></para>
    </header>
    <para styleclass="Notes"><text styleclass="Notes" translate="true">This documentation only applies to WPF</text></para>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">Catel also uses pixel shaders to apply effects to controls via themes and styles. One of the pixel shaders is, for example, the </text><link displaytype="text" defaultstyle="true" type="topiclink" href="T_Catel_Windows_Media_Effects_GrayscaleEffect" styleclass="Normal" translate="true">GrayscaleEffect</link><text styleclass="Normal" translate="true">. This effect automatically converts an image on a button to gray scale when the button is disabled. Below is an example of the shader effect:</text></para>
    <para styleclass="Normal"><image src="pixelshaders.png" scale="100.00%" styleclass="Image Caption"></image></para>
    <para styleclass="Normal"><text styleclass="Normal" translate="true">If there are a lot of buttons used on the screen, it might be possible that the video card does not support so many shaders, and then WPF will start throwing exceptions. In that case, first try to set the shader mode of Catel to </text><text styleclass="Normal" style="font-style:italic;" translate="true">ShaderRenderMode.Software</text><text styleclass="Normal" translate="true">. If that doesn’t work, you can turn the shaders off by using </text><text styleclass="Normal" style="font-style:italic;" translate="true">ShaderRenderMode.Off</text><text styleclass="Normal" translate="true">.</text></para>
    <para styleclass="Code Example"><text styleclass="Code Example" style="font-weight:normal; font-style:italic; color:#000000;" translate="true">// Force software rendering</text><br/><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">StyleHelper.PixelShaderMode</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#ffffff;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#ffffff;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">PixelShaderMode.Software;</text><br/><br/><text styleclass="Code Example" style="font-weight:normal; font-style:italic; color:#000000;" translate="true">// Turn off</text><br/><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">StyleHelper.PixelShaderMode</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#ffffff;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">=</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#ffffff;" translate="true">&#32;</text><text styleclass="Code Example" style="font-weight:normal; font-style:normal; color:#000000;" translate="true">PixelShaderMode.Off;</text></para>
  </body>
</topic>
